package com.hyt.it.ogt.ks.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hyt.it.ogt.ks.model.entity.AnswerProgress;
import com.hyt.it.ogt.ks.model.vo.AnswerProgressVO;

import java.util.Map;

/**
 * @author liuhenghuo
 */
public interface IAnswerProgressService extends IService<AnswerProgress> {
    int saveItem(AnswerProgress answerProgress);

    /**
     * 返回对应考生的某一题的使用过了多少时长
     * @param examId
     * @param candidateId
     * @param paperSort
     * @return
     */
    Long getByExamIdAndCandidateId(String examId,String candidateId,Integer paperSort,String itemId,String childItemId);

    /**
     * 清理考生某一个试卷的进度
     *
     * @param examId
     * @param candidateId
     * @param paperSort
     * @param paperId
     * @return
     */
    Boolean clearCandidateProcess(String examId, String candidateId, Integer paperSort, String paperId,Boolean needFlag);


    /**
     * 清理考生某一个试卷的进度  --- reids重置标识
     *
     * @param examId
     * @param candidateId
     * @return
     */
    Boolean clearCandidateProcessRedisKey(String examId, String candidateId);

    /**
     * 获取当前题进度
     * @param examId
     * @param candidateId
     * @param paperSort
     * @return
     */
    AnswerProgressVO getCurrentItem(String examId, String candidateId, Integer paperSort);

    /**
     * 保存答题进度
     * @return
     */
    void saveCurrentItem(AnswerProgress answerProgress);

    /**
     * 定时保存答题进度
     * @return
     */
    Map<String,Boolean> timingSaveItem(AnswerProgress answerProgress);

    /**
     * 重置答题时长撤销交卷时
     * @param examId
     * @param candidateId
     * @param candidatePaperId
     * @return
     */
    Boolean resetAnswerTimeCancelPaper(String examId, String candidateId, String candidatePaperId);
}
